package cn.buk.tms.entity.misc;

import cn.buk.tms.entity.base.BaseInfo;
import com.fasterxml.jackson.annotation.JsonFormat;

import java.util.Date;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import jakarta.persistence.Temporal;
import jakarta.persistence.TemporalType;
import jakarta.persistence.UniqueConstraint;
import jakarta.validation.constraints.Size;

/**
 * 配送单
 *
 * @author yfdai
 */
@Entity
@Table(name = "delivery_note", uniqueConstraints = @UniqueConstraint(name = "uk_delivery_note", columnNames = {
        "enterprise_id", "order_no"}))
public class DeliveryNote extends BaseInfo {

  /**
   * 配送单号
   */
  @Column(name = "order_no", length = 12, nullable = false)
  private String orderNo;

  /**
   * 待配送的订单类型
   */
  @Column(name = "delivered_order_type", length = 4)
  private String deliveredOrderType;

  /**
   * 待配送的订单号
   */
  @Column(name = "delivered_order_no", length = 15)
  private String deliveredOrderNo;

  /**
   * 订单的ID，
   */
  @Column(name = "delivery_order_id")
  private Integer deliveryOrderId;

  /**
   * 配送内容
   */
  @Size(min = 1, max = 50)
  @Column(name = "delivered_content", length = 50)
  private String deliveredContent;

  /**
   * 配送日期
   */
  @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
  @Temporal(TemporalType.DATE)
  @Column(name = "delivery_date")
  private Date deliveryDate;

  /**
   * 收件人
   */
  @Size(min = 1, max = 20)
  @Column(length = 20)
  private String receiver;

  /**
   * 联系电话
   */
  @Size(min = 1, max = 20)
  @Column(length = 20)
  private String mobile;

  /**
   * 配送地址
   */
  @Size(min = 1, max = 100)
  @Column(length = 100)
  private String address;

  private String remark;

  /**
   * 状态
   * 0 - 待配送
   * 1 - 配送中
   * 2 - 配送完成
   * 4 - 取消
   */
  private int status;

  /**
   * 创建的用户名
   */
  @Column(length = 32)
  private String operator;

  /**
   * 处理人
   */
  @Column(length = 32)
  private String processor;


  public String getOrderNo() {
    return orderNo;
  }

  public void setOrderNo(String orderNo) {
    this.orderNo = orderNo;
  }

  public String getDeliveredOrderType() {
    return deliveredOrderType;
  }

  public void setDeliveredOrderType(String deliveredOrderType) {
    this.deliveredOrderType = deliveredOrderType;
  }

  public String getDeliveredOrderNo() {
    return deliveredOrderNo;
  }

  public void setDeliveredOrderNo(String deliveredOrderNo) {
    this.deliveredOrderNo = deliveredOrderNo;
  }

  public String getDeliveredContent() {
    return deliveredContent;
  }

  public void setDeliveredContent(String deliveredContent) {
    this.deliveredContent = deliveredContent;
  }

  public String getReceiver() {
    return receiver;
  }

  public void setReceiver(String receiver) {
    this.receiver = receiver;
  }

  public String getMobile() {
    return mobile;
  }

  public void setMobile(String mobile) {
    this.mobile = mobile;
  }

  public String getAddress() {
    return address;
  }

  public void setAddress(String address) {
    this.address = address;
  }

  public String getRemark() {
    return remark;
  }

  public void setRemark(String remark) {
    this.remark = remark;
  }

  public int getStatus() {
    return status;
  }

  public void setStatus(int status) {
    this.status = status;
  }

  public String getOperator() {
    return operator;
  }

  public void setOperator(String operator) {
    this.operator = operator;
  }

  public String getProcessor() {
    return processor;
  }

  public void setProcessor(String processor) {
    this.processor = processor;
  }

  public Date getDeliveryDate() {
    return deliveryDate;
  }

  public void setDeliveryDate(Date deliveryDate) {
    this.deliveryDate = deliveryDate;
  }

  public int getDeliveryOrderId() {
    return deliveryOrderId == null ? 0 : deliveryOrderId;
  }

  public void setDeliveryOrderId(Integer deliveryOrderId) {
    this.deliveryOrderId = deliveryOrderId;
  }
}
